<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="pku.lbs.web.*, pku.lbs.web.utils.*" %>
<%
    String initData = SearchWeb.getInstance().doSearchAll(request, response);
    initData = (initData == null ? "" : Tools.encodeBase64(initData));
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>GateCaller | Management Console</title>
        <link href="style.css" rel="stylesheet" type="text/css" />
        <link rel="shortcut icon" href="logo.ico" />
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="description" content="GateCaller | Management Console"/>
        <meta name="revisit-after" content="2 days" />
        <meta name="robots" content="index" />

        <link href="style.css" rel="stylesheet" type="text/css" />
    </head>

    <script type="text/javascript" src="scripts/prototype/prototype.js"></script>
    <script type="text/javascript" src="scripts/gc_global.js"></script>
    <script type="text/javascript" src="scripts/gc_util.js"></script>
    <script type="text/javascript">
        function initPage() {
            $('svg_map_div').observe('mousemove', function (ev) {
                setXY( ev );             // FILL TEXT TO SHOW MOUSE POSITION
            });

            $('svg_map_div').observe('click', function (ev) {
                showMarker( ev );        // SHOW MARKER ( A PHONE IMAGE)
            });

            $('marker').observe('mousedown', function (ev) {
                if (ev.button == 2) {
                    showMenu(this);
                }
            });
            
            var initData = '<%= initData %>';
            initData = (initData == '' ? '' : Base64.decode( initData ).evalJSON( true ));
            if(!(typeof initData.RETURN == 'undefined')){
                if( initData.RETURN ) {
                    showAllUserList( initData.terminalList );
                } else {

                }
            }
        }
    </script>
    <body oncontextmenu="return false;" style="background:none">
        <div id="marker" ondblclick="showMenu(this);" style="display:none; position:absolute; z-index:50">
            <img id="marker_image" src="images/phone.gif">
        </div>
        
        <div id="menu" style="display:none; position:absolute; z-index:50; ">
            <ul>
                <li><div onclick="showSendMsgDialog();" style="cursor:pointer"><img src="images/email.gif">&nbsp;&nbsp;<a href="#">发信息</a></div></li>
                <li><div onclick="showSendFileDialog();" style="cursor:pointer"><img src="images/fujian.png">&nbsp;&nbsp;<a href="#">发文件</a></div></li>
                <li><div onclick="showBroadcastDialog();" style="cursor:pointer"><img src="images/broadcast.png">&nbsp;&nbsp;<a href="#">广&nbsp;&nbsp;播</a></div></li>
                <li><div onclick="searchUser(this);" style="cursor:pointer"><img src="images/search.png">&nbsp;&nbsp;<a href="#">搜&nbsp;&nbsp;索</a></div></li>
                <li><div onclick="showZoneDetail(this);" style="cursor:pointer"><img src="images/info.png">&nbsp;&nbsp;<a href="#">详&nbsp;&nbsp;情</a></div></li>
            </ul>
        </div>

        <div id="single_menu" style="display:none; position:absolute; z-index:50; ">
            <ul>
                <li><div onclick="showSendSingleMsgDialog();" style="cursor:pointer"><img src="images/email.gif">&nbsp;&nbsp;<a href="#">发信息</a></div></li>
                <li><div onclick="showSendSingleFileDialog();" style="cursor:pointer"><img src="images/fujian.png">&nbsp;&nbsp;<a href="#">发文件</a></div></li>
                <li><div onclick="showSendSingleSmsDialog();" style="cursor:pointer"><img src="images/phone.gif">&nbsp;&nbsp;<a href="#">发短信</a></div></li>
            </ul>
        </div>

        <div id="send_msg_dialog" style="display:none; position:absolute; z-index:50">
            <table>
                <tr>
                    <td colspan="2">
                        <textarea id="short_msg" value="请在这里输入信息" rows="5" cols="30"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div id="loading_send_msg"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="send_msg_button" type="button" value="发送" onclick="sendMsg();" />
                    </td>
                    <td>
                        <input id="cancel_msg_button" type="button" value="取消" onclick="cancelMsg();" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="broadcast_dialog" style="display:none; position:absolute; z-index:50">
            <table>
                <tr>
                    <td colspan="2">
                        <textarea id="broadcast_content" value="请在这里输入信息" rows="5" cols="30"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div id="loading_broadcast"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="send_msg_button" type="button" value="发送" onclick="broadcast();" />
                    </td>
                    <td>
                        <input id="cancel_msg_button" type="button" value="取消" onclick="cancel('broadcast_dialog');" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="send_file_dialog" style="display:none; position:absolute; z-index:50; border-style:solid; border-width:thin; border-color:lime">
            <form action="upload.jsp?type=0" target="form_submit_iframe" method="post" enctype="multipart/form-data" onsubmit="show_send_msg('upload_message', '发送中...');">
                <table>
                    <tr>
                        <td colspan="2">
                            <input type="file" id="send_file" name="send_file" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div id="upload_message"></div>
                            <iframe id="form_submit_iframe" name="form_submit_iframe" style="width:0px; height:0px; overflow:hidden; display:none"></iframe>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input id="send_file_button" type="submit" value="发送" />
                        </td>
                        <td>
                            <input id="cancel_file_button" type="button" value="取消" onclick="cancelFile();" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>

        <div id="send_single_msg_dialog" style="display:none; position:absolute; z-index:50">
            <table>
                <tr>
                    <td colspan="2">
                        <textarea id="single_short_msg" value="请在这里输入信息" rows="5" cols="30"></textarea><input type="hidden" id="hidden_user_id">
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div id="single_loading_send_msg"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="send_msg_button" type="button" value="发送" onclick="sendSingleMsg();" />
                    </td>
                    <td>
                        <input id="cancel_msg_button" type="button" value="取消" onclick="cancelSingleMsg();" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="send_single_file_dialog" style="display:none; background-color:lime; position:absolute; z-index:50; border-style:solid; border-width:thin; border-color:lime">
            <form action="upload.jsp?type=1" target="single_form_submit_iframe" method="post" enctype="multipart/form-data" onsubmit="show_send_msg('single_upload_message', '发送中...');">
                <table>
                    <tr>
                        <td colspan="2">
                            <label><font color="green">用户ID</font></label><input type="text" id="user" name="user"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <input type="file" id="single_send_file" name="single_send_file" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <div id="single_upload_message"></div>
                            <iframe id="single_form_submit_iframe" name="single_form_submit_iframe" style="width:0px; height:0px; overflow:hidden; display:none"></iframe>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input id="send_file_button" type="submit" value="发送" />
                        </td>
                        <td>
                            <input id="cancel_file_button" type="button" value="取消" onclick="cancelSingleFile();" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>

        <div id="send_single_sms_dialog" style="display:none; background-color:lime; position:absolute; z-index:50; border-style:solid; border-width:thin; border-color:lime">
            <table>
                <tr>
                    <td colspan="2">
                        <label><font color="green">手机号码</font></label><input type="text" id="tel" name="tel"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <textarea id="sms" rows="5" cols="30"></textarea>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <div id="single_sms"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="send_button" type="button" value="发送" onclick="sendSingleSms();" />
                    </td>
                    <td>
                        <input id="cancel_button" type="button" value="取消" onclick="cancel('send_single_sms_dialog');" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="user_list_div" style="display:none; background-color:Lime; position:absolute; width:auto; height:auto; z-index:50; border-style:solid; border-width:thin; border-color:lime">
            <table>
                <tr>
                    <td align="center">
                        <ul id="user_list">
                            
                        </ul>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="cancel_button" type="button" value="返回" onclick="cancel('user_list_div');" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="zone_detail_div" style="display:none; background-color:Lime; position:absolute; width:auto; height:auto; z-index:50; border-style:solid; border-width:thin; border-color:lime">
            <table>
                <tr>
                    <td align="center">
                        <div id="zone_detail"></div>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input id="cancel_button" type="button" value="返回" onclick="cancel('zone_detail_div');" />
                    </td>
                </tr>
            </table>
        </div>

        <div id="body_container">
            <div style="margin-top:10px; height:100px;">
                <table width="100%">
                    <tr>
                        <td>
                            <img src="images/plane.jpg" alt="GateCaller管理平台">
                            <b><font face="华文新魏" size="6" color="Lime">GateCaller管理平台</font></b>
                        </td>
                        <td align="right" valign="bottom">
                            <input type="button" name="monitor" id="monitor" value="探测" onclick="monitor();">
                        </td>
                        <td align="right" valign="bottom">
                            <label style="color:Lime;">加载地图(.svg) </label><input type="file" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label><font color="Lime">X坐标</font></label><input type="text" id="x_pos" name="x_pos">
                            <label><font color="Lime">Y坐标</font></label><input type="text" id="y_pos" name="y_pos">
                        </td>
                    </tr>
                </table>
            </div>
            <div class="clear"></div>
            <!-- 
            <iframe src="map.svg" style="margin-top:30px; height:150px; width:100%; height:400px"></iframe>
            -->
            <!--
            <div id="svg_map_div" style="position:absolute;width:800px;height:500px;"></div>
            <embed id="svg_map_img" style="width:auto;height:auto;" type="image/svg+xml" src="./svg_map.svg"></embed>
            -->
            <div id="svg_map_div"><img id="svg_map_img" src="floor.jpg" /></div>
            <div id="frame_footer" style=" background:#EBF3FB; margin-top:10px;">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="20"></td>
                        <td align="left"><a href="#">关于GateCaller</a></td>
                        <td align="right">copyright © 2009 PKU SS</td>
                        <td width="20"></td>
                    </tr>
                </table>
            </div>
        </div>
    </body>
</html>